//###########################################################################
//
// FILE:   DSP281x_Spi.c
//
// TITLE:  DSP281x SPI Initialization & Support Functions.
//
//###########################################################################
//
//  Ver | dd mmm yyyy | Who  | Description of changes
// =====|=============|======|===============================================
//  1.00| 11 Sep 2003 | L.H. | No change since previous version (v.58 Alpha)
//###########################################################################

#include "DSP281x_Device.h"     // DSP281x Headerfile Include File


//---------------------------------------------------------------------------
// InitSPI: 
//---------------------------------------------------------------------------
// This function initializes the SPI(s) to a known state.
//
void InitSpi(void)
{
  // Initialize SPI FIFO registers
  SpiaRegs.SPIFFTX.all = 0xE040;
  SpiaRegs.SPIFFRX.all = 0x204f;
  SpiaRegs.SPIFFCT.all = 0x0;


  // Initialize SPI-A:
  SpiaRegs.SPICCR.all = 0x0007;	             // Reset on, rising edge, 8-bit char bits  
  SpiaRegs.SPICTL.all = 0x0006;    		     // Enable master mode, normal phase,
                                                 // enable talk, and SPI int disabled.
  SpiaRegs.SPIBRR = SPI_A_BRR_VAL;
  SpiaRegs.SPICCR.all = 0x0097;		         // Relinquish SPI from Reset   
  SpiaRegs.SPIPRI.bit.FREE = 1;                // Set so breakpoints don't disturb xmission
}

//===========================================================================
// No more.
//===========================================================================
